package ui;

import dao.AccountDao;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import service.AccountService;
import service.impl.AccountServiceImpl;

public class Client {

    /*
    * 获取Spring的IOC核心容器,根据id获取对象
    * */
    public static void main(String[] args) {
        //1:获取核心容器对象
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("bean.xml");
        //2:根据id获取bean对象
        AccountService as = (AccountService) applicationContext.getBean("accountService");
        AccountDao adao = applicationContext.getBean("accountDao",AccountDao.class);

        System.out.println(as);
        System.out.println(adao);

//        service.saveAccount();
    }
}
